$(function () {
  //toolbar权限控制
  var editFlag = permissions.pre_outsys_edit
  var delFlag = permissions.pre_outsys_del
  var addFlag = permissions.pre_outsys_add
  if (!addFlag) {
    $('#addBtn').remove()
  }
  var options = {
    url: api + "/comm/outsystem/page",
    updateUrl: "/pages/pre/outsystem/edit",
    removeUrl: api + "/comm/outsystem/{id}",
    modalName: "接出节点",
    columns: [
      {
        title: "序号",
        formatter: function (value, row, index) {
          return $.table.serialNumber(index);
        }
      },
      {
        field: 'name',
        title: '项目名称'
      },
      {
        field: 'code',
        title: '项目编码'
      },
      {
        field: 'remark',
        title: '备注'
      },
      {
        title: '操作',
        formatter: function (value, row, index) {
          var actions = [];
          if (editFlag) {
            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sysId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
          }
          if (delFlag) {
            actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sysId + '\')"><i class="fa fa-remove"></i>删除</a> ');
          }
          return actions.join('');
        }
      }]
  };
  $.table.init(options);
});